extends ../layout

block content
  style
    include index.css
  .container-xxl
    h1.text-center.py-4= title
    table.table.mx-auto(border="1" cellspacing="0")
      thead
        tr
          each item in ['项目名称', '任务类型', '任务内容', '用时(小时)', '完成度', '创建时间', '操作']
            th #{item}
      tbody
        each item, index in list
          tr(class= (index % 2 == 0) ? 'table-primary' : 'table-success')
            each key in ['projectname', 'typename', 'con', 'duration', 'percent', 'createtime']
              if (key == 'percent')
                td #{item[key] + '%'}
              else
                td #{item[key]}
            td.table-primary
              a.btn.btn-primary(href="/task/" + item.id + '?proId=' + item.pro_id + '&typeId=' + item.type + '&source=report' style="margin-left: 10px;") 修改
              a.btn.btn-primary(href="/task/delete?taskId=" + item.id + '&proId=' + item.pro_id + '&source=report' style="margin-left: 10px;") 删除

    //- 展示
    ul(style="list-style-type: none;")
      each item, index in group
        li #{item[0].today}
        each row, rowIndex in item
          li= (rowIndex + 1) + '.' + row.typename + '：' + row.projectname + '-' + row.con + ' ' + row.percent + '%'

    if err
      .alert.alert-danger= err

    div
      a.btn.btn-primary(href="/task/add?source=report") 添加任务
      a.btn.btn-primary(href="/home" style="margin-left: 10px;") 返回首页
      a.btn.btn-primary(href="/report/download" style="margin-left: 10px;") 下载
      if !hasSend
        a.btn.btn-primary(href="/report/send" style="margin-left: 10px;") 发送日报
  script
    include index.js